#pragma once
#include <nice2d/component.h>
#include <nice2d/movingsprite.h>
#include <nice2d/serializer.h>

class Flocking : public Component
{
public:
    Flocking(NodePointer owner = nullptr);
    ~Flocking();
public:
    void setSprites(const MovingSprites &sprites);

    void setMaxSpeed(float speed);
    float getMaxSpeed()const;

    void setMaxForce(float force);
    float getMaxForce()const;

    void setMaxNeighbordDistance(float distance);
    float getMaxNeighbordDistance()const;

    void  setMinSeparation(float separation);
    float getMinSeparation()const;

    void setBorderArea(const sf::FloatRect &area);
public:
    PTree serialize()override;
    void deserialize(const PTree &node)override;
    void update(float time)override;
private:
    std::unique_ptr<class FlockingData> data;
};
